package com.leetcode.LC_MED;

public class LC226 {
    public TreeNode invertTree(TreeNode root) {

        toRe(root);
        return root;
    }

    private void toRe(TreeNode root) {
        if (root == null) {
            return;
        }
        if (root != null) {
            TreeNode tmp = root.left;
            root.left = root.right;
            root.right = tmp;
        }
        toRe(root.left);
        toRe(root.right);
    }
}
